package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduhHouseDetailIntegration;
import com.jwsoft.manager.common.vo.eduhHouseDetail.EduhHouseDetailVO;
import com.jwsoft.manager.common.vo.eduhHouseDetail.EduhHouseDetailKeyVO;
import com.jwsoft.manager.common.vo.eduhHouseDetail.EduhHouseDetailQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 房产信息历史表网关
 *
 * @author zhiyuan
 * @since 2023-09-21
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "房产信息历史表", description = "房产信息历史表")
public class EduhHouseDetailController {

    @Autowired
    public EduhHouseDetailIntegration eduhHouseDetailIntegration;

    @Operation(summary = "房产信息历史表分页查询",description = "房产信息历史表分页查询")
    @PostMapping(value = "/eduhHouseDetail0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduhHouseDetailVO>> getList(@RequestBody @Validated EduhHouseDetailQueryVO vo) {
        return AppResponse.successData(eduhHouseDetailIntegration.getList(vo));
    }

    @Operation(summary = "房产信息历史表根据主键查询详情",description = "房产信息历史表根据主键查询详情")
    @PostMapping(value = "/eduhHouseDetail0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduhHouseDetailVO> getById(@RequestBody @Validated EduhHouseDetailKeyVO vo) {
        return AppResponse.successData(eduhHouseDetailIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产信息历史表新增",description = "房产信息历史表新增")
    @PostMapping(value = "/eduhHouseDetail0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduhHouseDetailVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduhHouseDetailVO vo) {
        return AppResponse.successData(eduhHouseDetailIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产信息历史表修改",description = "房产信息历史表修改")
    @PostMapping(value = "/eduhHouseDetail0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduhHouseDetailVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduhHouseDetailVO vo) {
        return AppResponse.successData(eduhHouseDetailIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产信息历史表删除",description = "房产信息历史表删除")
    @PostMapping(value = "/eduhHouseDetail0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduhHouseDetailKeyVO vo) {
        eduhHouseDetailIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
